<template>
    <div class="page_root" :key="queryUpdateFlag" data-page-name="1" data-page-identification="x_hb0xe6o0k2">
        <a-spin :spinning="pageLoading.loading" :tip="pageLoading.tip">
            <!-- begin vid_q2pj193dfc 自定义模板_7xu4mdl9mj -->
            <!-- begin vid_xxv30sgb5n 自定义模板_b1mjff58ch -->
            <a-modal
                :title="tgNoSt.title"
                :visible="tgNoSt.visible"
                @ok="submitTgNoProject"
                width="1000px"
                :body-style="{ maxHeight: '700px', overflowY: 'auto' }"
                @cancel="tgNoStCancel"
                ok-text="提交"
                :maskClosable="false"
                destroy-on-close
                :ok-button-props="{ loading: tgNoSt.okDisibled }"
            >
                <a-form :model="tgNoSt.form" ref="tgNoStRef">
                    <div class="tg-no-st">
                        <div class="pj-title">
                            <div class="pj-title-son">基本信息</div>
                        </div>
                        <a-row :gutter="24">
                            <a-col :span="12">
                                <a-form-item
                                    label="项目模板"
                                    name="projectTemplate"
                                    :rules="[{ required: true, message: '请选择项目模板', trigger: 'blur' }]"
                                >
                                    <a-select
                                        :disabled="tgNoSt.isEdit"
                                        :options="tgNoSt.projectTemplateList"
                                        :field-names="{ label: 'templateName', value: 'templateCode' }"
                                        @focus="getTemplate"
                                        @change="changeTemplate"
                                        :filter-option="
                                            (input, option) => {
                                                return (
                                                    option.templateName.toLowerCase().indexOf(input.toLowerCase()) >= 0
                                                )
                                            }
                                        "
                                        v-model:value="tgNoSt.form.projectTemplate"
                                    />
                                </a-form-item>
                            </a-col>
                            <a-col :span="12">
                                <a-form-item
                                    label="项目名称"
                                    name="projectName"
                                    :rules="{ required: true, message: '请输入工厂名称', trigger: 'blur' }"
                                >
                                    <a-input v-model:value="tgNoSt.form.projectName" />
                                </a-form-item>
                            </a-col>
                        </a-row>
                        <a-row :gutter="24">
                            <a-col :span="12">
                                <a-form-item
                                    label="项目关联菜单"
                                    name="parentId"
                                    :rules="{ required: true, message: '请选择项目关联菜单', trigger: 'blur' }"
                                >
                                    <a-tree-select
                                        :fieldNames="{
                                            children: 'children',
                                            label: 'projectName',
                                            value: 'projectId',
                                            key: 'projectId'
                                        }"
                                        :showSearch="true"
                                        :placeholder="'请输入或选择'"
                                        :allowClear="true"
                                        :treeData="tgNoSt.projectList"
                                        v-model:value="tgNoSt.form.parentId"
                                    />
                                </a-form-item>
                            </a-col>
                            <a-col :span="12">
                                <a-form-item
                                    label="项目优先级"
                                    name="projectPriority"
                                    :rules="{ required: true, message: '请选择项目优先级', trigger: 'blur' }"
                                >
                                    <a-select
                                        :options="[
                                            { label: '最高', value: '最高' },
                                            { label: '高', value: '高' },
                                            { label: '中', value: '中' },
                                            { label: '低', value: '低' },
                                            { label: '最低', value: '最低' }
                                        ]"
                                        :showSearch="true"
                                        :placeholder="'请输入或选择'"
                                        :allowClear="true"
                                        v-model:value="tgNoSt.form.projectPriority"
                                    />
                                </a-form-item>
                            </a-col>
                        </a-row>
                        <a-row :gutter="24">
                            <a-col :span="12">
                                <a-form-item label="计划开始时间" name="startTime" :rules="factoryRule.startTime">
                                    <a-date-picker
                                        v-model:value="tgNoSt.form.startTime"
                                        :valueFormat="'YYYY-MM-DD'"
                                        :placeholder="'请选择计划开始时间'"
                                        style="width: 100%"
                                    />
                                </a-form-item>
                            </a-col>
                            <a-col :span="12">
                                <a-form-item label="计划结束时间" name="endTime" :rules="factoryRule.endTime">
                                    <a-date-picker
                                        v-model:value="tgNoSt.form.endTime"
                                        :valueFormat="'YYYY-MM-DD'"
                                        :placeholder="'请选择计划结束时间'"
                                        style="width: 100%"
                                    />
                                </a-form-item>
                            </a-col>
                        </a-row>
                        <div class="pj-title">
                            <div class="pj-title-son">项目领导小组</div>
                        </div>
                        <a-row :gutter="24">
                            <a-col :span="12">
                                <a-form-item
                                    label="副总裁"
                                    name="projectPriority"
                                    :rules="{ required: true, message: '请选择副总裁', trigger: 'blur' }"
                                >
                                    <a-select
                                        :options="tgNoSt.peopleList"
                                        :allowClear="true"
                                        :dropdownMatchSelectWidth="true"
                                        :showSearch="true"
                                        :filterOption="
                                            (input, option) => {
                                                return option.name.toLowerCase().indexOf(input.toLowerCase()) >= 0
                                            }
                                        "
                                        :fieldNames="{
                                            label: 'name',
                                            value: 'name'
                                        }"
                                        :showArrow="true"
                                        v-model:value="tgNoSt.form.vicePresident"
                                    />
                                </a-form-item>
                            </a-col>
                        </a-row>
                        <div class="pj-title">
                            <div class="pj-title-son">项目组负责人</div>
                        </div>
                        <a-row :gutter="24">
                            <a-col :span="12">
                                <a-form-item
                                    label="产品总监"
                                    name="productDirector"
                                    :rules="{ required: true, message: '请选择产品总监', trigger: 'blur' }"
                                >
                                    <a-select
                                        :options="tgNoSt.peopleList"
                                        :allowClear="true"
                                        :dropdownMatchSelectWidth="true"
                                        :showSearch="true"
                                        :filterOption="
                                            (input, option) => {
                                                return option.name.toLowerCase().indexOf(input.toLowerCase()) >= 0
                                            }
                                        "
                                        :fieldNames="{
                                            label: 'name',
                                            value: 'name'
                                        }"
                                        :showArrow="true"
                                        v-model:value="tgNoSt.form.productDirector"
                                    />
                                </a-form-item>
                            </a-col>
                            <a-col :span="12">
                                <a-form-item
                                    label="PMO"
                                    name="projectManagementOffice"
                                    :rules="{ required: true, message: '请选择PMO', trigger: 'blur' }"
                                >
                                    <a-select
                                        :options="tgNoSt.peopleList"
                                        :allowClear="true"
                                        :dropdownMatchSelectWidth="true"
                                        :showSearch="true"
                                        :filterOption="
                                            (input, option) => {
                                                return option.name.toLowerCase().indexOf(input.toLowerCase()) >= 0
                                            }
                                        "
                                        :fieldNames="{
                                            label: 'name',
                                            value: 'name'
                                        }"
                                        :showArrow="true"
                                        v-model:value="tgNoSt.form.projectManagementOffice"
                                    />
                                </a-form-item>
                            </a-col>
                        </a-row>
                        <a-row :gutter="24">
                            <a-col :span="12">
                                <a-form-item
                                    label="产品经理"
                                    name="productLeaderName"
                                    :rules="{ required: true, message: '请选择产品经理', trigger: 'blur' }"
                                >
                                    <a-select
                                        :options="tgNoSt.peopleList"
                                        :allowClear="true"
                                        :dropdownMatchSelectWidth="true"
                                        :showSearch="true"
                                        :filterOption="
                                            (input, option) => {
                                                return option.name.toLowerCase().indexOf(input.toLowerCase()) >= 0
                                            }
                                        "
                                        :fieldNames="{
                                            label: 'name',
                                            value: 'name'
                                        }"
                                        :showArrow="true"
                                        v-model:value="tgNoSt.form.productLeaderName"
                                    />
                                </a-form-item>
                            </a-col>
                            <a-col :span="12">
                                <a-form-item
                                    label="测试总负责人"
                                    name="testManager"
                                    :rules="{
                                        required: true,
                                        message: '请选择测试总负责人',
                                        trigger: 'blur'
                                    }"
                                >
                                    <a-select
                                        :options="tgNoSt.peopleList"
                                        :allowClear="true"
                                        :dropdownMatchSelectWidth="true"
                                        :showSearch="true"
                                        :filterOption="
                                            (input, option) => {
                                                return option.name.toLowerCase().indexOf(input.toLowerCase()) >= 0
                                            }
                                        "
                                        :fieldNames="{
                                            label: 'name',
                                            value: 'name'
                                        }"
                                        :showArrow="true"
                                        v-model:value="tgNoSt.form.testManager"
                                    />
                                </a-form-item>
                            </a-col>
                        </a-row>
                        <div class="pj-title">
                            <div class="pj-title-son">项目组核心成员</div>
                        </div>
                        <a-row :gutter="24">
                            <a-col :span="12">
                                <a-form-item
                                    label="架构师"
                                    name="architectList"
                                    :rules="{
                                        required: true,
                                        message: '请选择架构师',
                                        trigger: 'blur'
                                    }"
                                >
                                    <a-select
                                        :options="tgNoSt.peopleList"
                                        :allowClear="true"
                                        :dropdownMatchSelectWidth="true"
                                        :showSearch="true"
                                        mode="multiple"
                                        :filterOption="
                                            (input, option) => {
                                                return option.name.toLowerCase().indexOf(input.toLowerCase()) >= 0
                                            }
                                        "
                                        :fieldNames="{
                                            label: 'name',
                                            value: 'name'
                                        }"
                                        :showArrow="true"
                                        v-model:value="tgNoSt.form.architectList"
                                    />
                                </a-form-item>
                            </a-col>
                            <a-col :span="12">
                                <a-form-item
                                    label="技术经理"
                                    name="technicalLeaderList"
                                    :rules="{
                                        required: true,
                                        message: '请选择技术经理',
                                        trigger: 'blur'
                                    }"
                                >
                                    <a-select
                                        :options="tgNoSt.peopleList"
                                        :allowClear="true"
                                        mode="multiple"
                                        :dropdownMatchSelectWidth="true"
                                        :showSearch="true"
                                        :filterOption="
                                            (input, option) => {
                                                return option.name.toLowerCase().indexOf(input.toLowerCase()) >= 0
                                            }
                                        "
                                        :fieldNames="{
                                            label: 'name',
                                            value: 'name'
                                        }"
                                        :showArrow="true"
                                        v-model:value="tgNoSt.form.technicalLeaderList"
                                    />
                                </a-form-item>
                            </a-col>
                        </a-row>
                        <a-row :gutter="24">
                            <a-col :span="12">
                                <a-form-item
                                    label="UI设计师"
                                    name="uiDesignerList"
                                    :rules="{
                                        required: true,
                                        message: '请选择UI设计师',
                                        trigger: 'blur'
                                    }"
                                >
                                    <a-select
                                        :options="tgNoSt.peopleList"
                                        :allowClear="true"
                                        mode="multiple"
                                        :dropdownMatchSelectWidth="true"
                                        :showSearch="true"
                                        :filterOption="
                                            (input, option) => {
                                                return option.name.toLowerCase().indexOf(input.toLowerCase()) >= 0
                                            }
                                        "
                                        :fieldNames="{
                                            label: 'name',
                                            value: 'name'
                                        }"
                                        :showArrow="true"
                                        v-model:value="tgNoSt.form.uiDesignerList"
                                    />
                                </a-form-item>
                            </a-col>
                            <a-col :span="12">
                                <a-form-item
                                    label="开发经理"
                                    name="developLeaderNameList"
                                    :rules="{
                                        required: true,
                                        message: '请选择开发经理',
                                        trigger: 'blur'
                                    }"
                                >
                                    <a-select
                                        :options="tgNoSt.peopleList"
                                        :allowClear="true"
                                        mode="multiple"
                                        :dropdownMatchSelectWidth="true"
                                        :showSearch="true"
                                        :filterOption="
                                            (input, option) => {
                                                return option.name.toLowerCase().indexOf(input.toLowerCase()) >= 0
                                            }
                                        "
                                        :fieldNames="{
                                            label: 'name',
                                            value: 'name'
                                        }"
                                        :showArrow="true"
                                        v-model:value="tgNoSt.form.developLeaderNameList"
                                    />
                                </a-form-item>
                            </a-col>
                        </a-row>
                        <a-row :gutter="24">
                            <a-col :span="12">
                                <a-form-item
                                    label="测试经理"
                                    name="testLeaderNameList"
                                    :rules="{
                                        required: true,
                                        message: '请选择测试经理',
                                        trigger: 'blur'
                                    }"
                                >
                                    <a-select
                                        :options="tgNoSt.peopleList"
                                        :allowClear="true"
                                        mode="multiple"
                                        :dropdownMatchSelectWidth="true"
                                        :showSearch="true"
                                        :filterOption="
                                            (input, option) => {
                                                return option.name.toLowerCase().indexOf(input.toLowerCase()) >= 0
                                            }
                                        "
                                        :fieldNames="{
                                            label: 'name',
                                            value: 'name'
                                        }"
                                        :showArrow="true"
                                        v-model:value="tgNoSt.form.testLeaderNameList"
                                    />
                                </a-form-item>
                            </a-col>
                            <a-col :span="12">
                                <a-form-item
                                    label="运维"
                                    name="devOpsList"
                                    :rules="{
                                        required: true,
                                        message: '请选择运维',
                                        trigger: 'blur'
                                    }"
                                >
                                    <a-select
                                        :options="tgNoSt.peopleList"
                                        :allowClear="true"
                                        :dropdownMatchSelectWidth="true"
                                        :showSearch="true"
                                        mode="multiple"
                                        :filterOption="
                                            (input, option) => {
                                                return option.name.toLowerCase().indexOf(input.toLowerCase()) >= 0
                                            }
                                        "
                                        :fieldNames="{
                                            label: 'name',
                                            value: 'name'
                                        }"
                                        :showArrow="true"
                                        v-model:value="tgNoSt.form.devOpsList"
                                    />
                                </a-form-item>
                            </a-col>
                        </a-row>
                    </div>
                </a-form>
            </a-modal>
            <a-button @click="handleAddTgNoProject">1</a-button>
            <!-- end vid_xxv30sgb5n 自定义模板_b1mjff58ch -->
            <!-- end vid_q2pj193dfc 自定义模板_7xu4mdl9mj -->
        </a-spin>
    </div>
</template>
<script setup lang="tsx">
    import {
        h,
        ref,
        reactive,
        toRaw,
        markRaw,
        watch,
        computed,
        onBeforeMount,
        onMounted,
        onBeforeUnmount,
        onUnmounted,
        onActivated,
        onDeactivated
    } from 'vue'
    import { useRoute, useRouter } from 'vue-router'
    const router = useRouter()
    const route = useRoute()
    import { get, post, put, del, request, requestWithHeaders } from '@/utils/http/Axios'
    import {
        cloneDeep,
        localGet,
        merge,
        getDifferenceArray,
        traversalTreeStructure,
        checkCaseCondition,
        renderStringInTemplate,
        handleBreadcrumbJump,
        throttle,
        permission,
        getComponentParamsValue
    } from '@/utils/index'
    import { isNullOrEmpty, isEmptyArr, isNullOrUnDef, isContained, isArray, isEmpty, isObject } from '@/utils/is'
    import dayjs from 'dayjs'
    import { getPagePcChartsDataSourceConvert } from '@/utils/chart'
    import { message, notification, Modal } from 'ant-design-vue'
    import {
        propertyFormatByNumber,
        propertyFormatByPercentage,
        propertyFormatByDate,
        parseSubFromDataList
    } from '@/utils/format'
    import colorTheme from '@/design/custom-theme.json'
    /*** PUBLISH_EXEGESIS ***
 import UserTableRecords from '@/model/UserTableRecords';
 import { getAppBaseUrl } from '@/utils/index';
 import { sendToken } from "@/hooks/useIframeToken";
 import { useSystemStore } from "@/store/modules/system";
 const systemStore = useSystemStore();
 *** PUBLISH_EXEGESIS ***/

    // 获取传入的流程ID和组件参数
    const props = defineProps({
        'processInstanceId': {
            type: [String, Number, Boolean],
            default: undefined
        }
    })
    const immediateWatch = (source, callback) => {
        watch(source, callback, { deep: true, immediate: true })
    }

    /* -------------------------- 属性定义 -------------------------- */

    const setTimeOutList = []
    const pageLoading = reactive({
        loading: false,
        tip: undefined
    })
    const authInfo = localGet('app-user-store')

    // 处理校验
    const setSubFormName = (parentInfo, name) => {
        return [parentInfo.parents, parentInfo.cycleIndex, name]
    }

    /* ========================== 属性定义 ========================== */

    /* -------------------------- 元素数据引用 -------------------------- */

    /* ========================== 元素数据引用 ========================== */

    /* -------------------------- 页面数据 -------------------------- */

    /* ========================== 页面数据 ========================== */

    /* -------------------------- 响应 -------------------------- */

    /* ========================== 响应 ========================== */

    /* -------------------------- 函数 -------------------------- */

    /* ========================== 函数 ========================== */

    /* -------------------------- 页面参数 -------------------------- */

    const pageParameter_state = reactive({
        'processInstanceId': props.processInstanceId ?? route.query.processInstanceId
    })

    /* ========================== 页面参数 ========================== */

    /* -------------------------- 组件事件处理方法 -------------------------- */

    // ---------------------------- 组件数据同步 ----------------------------

    // ============================ 组件数据同步 ============================

    /* ========================== 组件事件处理方法 ========================== */

    /* -------------------------- 生命周期 -------------------------- */
    // 用于参数变更后重新执行自定义指令
    const queryUpdateFlag = ref(0)
    onMounted(() => {})

    onUnmounted(() => {
        // 销毁定时器
        setTimeOutList.forEach(({ repeat, timer }) => {
            repeat ? clearInterval(timer) : clearTimeout(timer)
        })
    })

    /* ========================== 生命周期 ========================== */

    /* -------------------------- 数据关联处理 -------------------------- */

    /* -------------------------- 表单数据同步 -------------------------- */
    /* ========================== 表单数据同步 ========================== */

    /* ========================== 数据关联处理 ========================== */

    /* -------------------------- 不同组件自定义的处理逻辑 -------------------------- */

    /* ========================== 不同组件自定义的处理逻辑 ========================== */

    // ================================定制化逻辑========================================
    const projectId = ref(12)
    const tgNoSt = reactive({
        visible: false,
        isEdit: false,
        title: '',
        okDisibled: false,
        form: {
            projectTemplate: undefined,
            factoryName: undefined,
            projectName: undefined,
            parentId: undefined,
            projectPriority: undefined,
            startTime: undefined,
            endTime: undefined,
            deliveryTime: undefined,
            vicePresident: '叶丽文',
            productDirector: undefined,
            projectManagementOffice: undefined,
            architectList: undefined,
            productLeaderName: undefined,
            devOpsList: undefined,
            testLeaderNameList: undefined,
            technicalLeaderList: undefined,
            testManager: undefined,
            ppmProjectFirstPartyFormList: [],
            ppmEnclosureInfoList: [],
            commercialEnclosureInfoList: [],
            budgetEnclosureInfoList: [],
            budget: undefined,
            humanCostBudget: undefined,
            directExpenseBudget: undefined,
            description: undefined,
            reasonsChange: undefined,
            uiDesignerList: undefined,
            projectType: '产品研发',
            developLeaderNameList: undefined,
            projectId: projectId.value
        },

        projectTemplateList: [],
        //   工厂列表
        factoryNameList: [],
        //   项目关联菜单
        projectList: [],
        //   人列表
        peopleList: []
    })
    const ppmProjectFirstPartyItem = {
        role: undefined,
        firstPartyName: undefined
    }
    // 获取模板列表
    function getTemplate() {
        get('/solution-ppm/api/v2/built-in-system-ppm/project/template/create/platform_template_list').then(data => {
            if (data.code === 200) {
                tgNoSt.projectTemplateList = data.data.dataList

            } else {
                message.error('获取模板失败！')
            }
        })
    }

    //     获取工厂
    function getFactory() {
        get('/solution-ppm/api/v2/built-in-system-ppm/project_template/ptf/search').then(data => {
            if (data.code === 200) {
                tgNoSt.factoryNameList = data.data
            } else {
                message.error('获取工厂名称失败！')
            }
        })
    }
    const factoryRule = {
        factory: [
            {
                required: true,
                trigger: 'blur',
                validator: async (rule, value, callback) => {
                    if (!value) {
                        return Promise.reject('请选择工厂名称')
                    }
                    const { data } = await post(
                        `/solution-ppm/api/v2/built-in-system-ppm/project_template/check_factory_valid/${value}`
                    )

                    return data ? Promise.resolve() : Promise.reject(new Error('请选择区域下的工厂'))
                }
            }
        ],
        startTime: [
            {
                required: true,
                trigger: 'blur',
                validator: (rule, value, callback) => {
                    if (!value) {
                        return Promise.reject('请输入项目开始时间')
                    }
                    if (
                        value &&
                        tgNoSt.form.endTime &&
                        dayjs(value).format('YYYY-MM-DD hh-mm-ss') >
                            dayjs(tgNoSt.form.endTime).format('YYYY-MM-DD hh-mm-ss')
                    ) {
                        return Promise.reject('计划开始时间不能晚于计划结束时间')
                    }
                    return Promise.resolve()
                }
            }
        ],
        endTime: [
            {
                required: true,
                trigger: 'blur',
                validator: (rule, value, callback) => {
                    if (
                        value &&
                        tgNoSt.form.startTime &&
                        dayjs(value).format('YYYY-MM-DD hh-mm-ss') <
                            dayjs(tgNoSt.form.startTime).format('YYYY-MM-DD hh-mm-ss')
                    ) {
                        return Promise.reject('计划结束时间不能早于计划开始时间')
                    }
                    return Promise.resolve()
                }
            }
        ]
    }

    function getProjectList() {
        post('/solution-ppm/api/v2/built-in-system-ppm/v2/platform/project/tree', {
            source: 'MENU',
            nodeType: 'MENU'
        }).then(data => {
            if (data.code === 200) {
                tgNoSt.projectList = data.data
            } else {
                message.error('获取菜单失败！')
            }
        })
    }
    function getPlist() {
        get('/solution-ppm/api/v2/built-in-system-ppm/pmgf/get/allUser').then(data => {
            if (data.code === 200) {
                tgNoSt.peopleList = data.data.userDtoList
            } else {
                message.error('获取用户列表失败！')
            }
        })
    }

    function handlerDeletePartyItem(index) {
        tgNoSt.form.ppmProjectFirstPartyFormList.splice(index, 1)
    }
    function handlerAddPartyItem() {
        tgNoSt.form.ppmProjectFirstPartyFormList.push({ ...ppmProjectFirstPartyItem })
    }
    function handleAddTgNoProject() {
        getPlist()
        getProjectList()
        tgNoSt.form.ppmProjectFirstPartyFormList.push({ ...ppmProjectFirstPartyItem })
        tgNoSt.visible = true
        tgNoSt.title = '新建模板项目'
        tgNoSt.isEdit = false
    }

    const tgNoStRef = ref(null)
    function submitTgNoProject() {
        tgNoStRef.value.validate().then(() => {
            tgNoSt.okDisibled = true
            if (tgNoSt.isEdit) {
                post('/solution-ppm/api/v2/built-in-system-ppm/v2/delivery_project_generalization/edit', tgNoSt.form)
                    .then(data => {
                        if (data.code === 200) {
                            message.success('编辑项目已进入审批流程')
                            tgNoSt.visible = false
                            // TODO调树
                          // dataConnector_conn_15c3166i0t()
                            resetTgPjForm()
                        } else {
                            message.error(data.message)
                        }
                    })
                    .finally(() => {
                        tgNoSt.okDisibled = false
                    })
            } else {
                // 新增推广有模板项目
                post('/solution-ppm/api/v2/built-in-system-ppm/v2/platform_project_template/add', tgNoSt.form)
                    .then(data => {
                        console.log(data, 'dasdasd')
                        if (data.code === 200) {
                            message.success('新建项目已进入审批流程')
                            // TODO调树
                          // dataConnector_conn_15c3166i0t()
                            tgNoSt.visible = false
                            resetTgPjForm()
                        } else {
                            message.error(data.message)
                        }
                    })
                    .finally(() => {
                        tgNoSt.okDisibled = false
                    })
            }
        })
    }

    function editTgNoProject() {
        // 使用 Promise.all() 等待所有异步方法完成
        Promise.all([getFactory(), getPlist(), getProjectList(), getTemplate()])
            .then(() => {
                // 在所有方法都成功完成后执行最后一步
                get(`/solution-ppm/api/v2/built-in-system-ppm/delivery_project/${projectId.value}`).then(({ data }) => {
                    tgNoSt.form = Object.assign({}, tgNoSt.form, data)
                    if (!data.projectTemplate) {
                        tgNoSt.form.projectTemplate = '无模板'
                    }
                    tgNoSt.visible = true
                    tgNoSt.isEdit = true
                    tgNoSt.title = '编辑模板项目'
                })
            })
            .catch(error => {
                // 如果其中任何一个方法失败，处理错误
                console.error('Error:', error)
            })
    }
    function tgNoStCancel() {
        resetTgPjForm()
        tgNoSt.visible = false
        console.log('触发')
    }
    function resetTgPjForm() {
        tgNoSt.form = {
            projectTemplate: undefined,
            factoryName: undefined,
            projectName: undefined,
            parentId: undefined,
            projectPriority: undefined,
            startTime: undefined,
            endTime: undefined,
            deliveryTime: undefined,
            vicePresident: '叶丽文',
            productDirector: undefined,
            projectManagementOffice: undefined,
            productLeaderName: undefined,
            devOpsList: undefined,
            architectList: undefined,
            testLeaderNameList: undefined,
            technicalLeaderList: undefined,
            testManager: undefined,
            ppmProjectFirstPartyFormList: [],
            ppmEnclosureInfoList: [],
            commercialEnclosureInfoList: [],
            budgetEnclosureInfoList: [],
            budget: undefined,
            humanCostBudget: undefined,
            directExpenseBudget: undefined,
            description: undefined,
            reasonsChange: undefined,
            uiDesignerList: undefined,
            projectType: '产品研发',
            developLeaderNameList: undefined,
            projectId: projectId.value
        }
    }
    function changeTemplate(value) {
        if (value == '无模板') {
            tgNoSt.form.factoryName = undefined
        }
    }
</script>
<style lang="less" scoped>
    .page_root {
        width: 100%;
        height: 100%;
        overflow: auto;
    }
    .page_root :deep(.@{ant-prefix}-spin-nested-loading),
    .page_root :deep(.@{ant-prefix}-spin-container) {
        height: 100%;
    }
    .page_root :deep(.@{ant-prefix}-spin-container .@{ant-prefix}-table-wrapper) {
        display: flex;
        flex-flow: column nowrap;
        justify-content: flex-start;
    }
    .page_root :deep(.@{ant-prefix}-table) {
        flex: auto;
        overflow: auto;
    }
    .table-moreBtn_down {
        overflow: hidden;
        white-space: nowrap;
        text-overflow: ellipsis;
        width: 100px;
    }

    .table-moreBtn_menu :deep(.table-moreBtn_menu-item):hover {
        background: #ebf1ff;
    }

    /*  表格树结构样式处理，展开按钮层级增加*/
    :deep(.@{ant-prefix}-table-row-expand-icon) {
        z-index: 1;
    }
    /*  表格树结构 由于每个表格项采用自定义组件，使用绝对定位布局，开启树结构导致显示异常，暂时使用层级定位位置 */
    :deep(.@{ant-prefix}-table-row-level-1 .@{ant-prefix}-table-cell-with-append .cell-wrapper-left) {
        left: 15px !important;
        width: calc(100% - 15px);
    }
    :deep(.@{ant-prefix}-table-row-level-2 .@{ant-prefix}-table-cell-with-append .cell-wrapper-left) {
        left: 30px !important;
        width: calc(100% - 30px);
    }
    :deep(.@{ant-prefix}-table-row-level-3 .@{ant-prefix}-table-cell-with-append .cell-wrapper-left) {
        left: 45px !important;
        width: calc(100% - 45px);
    }
    :deep(.@{ant-prefix}-table-row-level-4 .@{ant-prefix}-table-cell-with-append .cell-wrapper-left) {
        left: 60px !important;
        width: calc(100% - 60px);
    }

    /* 穿梭框改变默认样式，为根据组件样式控制左右栏宽度。 */
    :deep(.@{ant-prefix}-transfer-list) {
        height: 100%;
        width: 50%;
    }

    /*样式*/
    /*
  定制
  */
    .pj-title {
        height: 30px;
        border-bottom: 1px solid #bfbfbf;
        margin-bottom: 16px;
    }
    .pj-title-son {
        font-family: PingFangSC-Semibold;
        font-size: 14px;
        color: #262626;
        letter-spacing: 0;
        font-weight: 600;
        border-left: 4px solid #3875ff;
        padding-left: 5px;
        height: 18px;
        line-height: 18px;
    }
    :deep(.tg-no-st .ant3-form-item-label) {
        width: 115px !important;
    }
    .del {
        width: 66px;
        color: #3875ff;
        float: right;
    }
    .add-btn-role {
        margin-bottom: 20px;
    }
    .role-content {
        display: inline-block;
        width: calc(100% - 80px);
    }
    :deep(.role-content .ant3-form-item-label) {
        width: 115px !important;
    }
    .no-border {
        border: none;
    }
    /*样式*/
    .milepost-table :deep(.@{ant-prefix}-table-thead) > tr > th {
        background: #3875ff;
        font-size: 14px;
        font-family: arial, helvetica, 'microsoft yahei';
        font-weight: 600;
        color: #ffffff;
        border-bottom: 1px solid #3875ff;
        padding: 0 16px;
    }
    .check-table :deep(.@{ant-prefix}-table-thead) > tr > th {
        background: #3875ff;
        font-size: 14px;
        font-family: arial, helvetica, 'microsoft yahei';
        font-weight: 600;
        color: #ffffff;
        border-bottom: 1px solid #3875ff;
        padding: 0 16px;
    }

    .milepost-table :deep(.@{ant-prefix}-table-thead) > tr {
        height: 40px;
    }
    .check-table :deep(.@{ant-prefix}-table-thead) > tr {
        height: 40px;
    }
    :deep(.milepost-table .ant3-table-tbody > tr > td) {
        padding: 8px 8px;
    }
    :deep(.check-table .ant3-table-tbody > tr > td) {
        padding: 4px 8px;
    }
    .milepost-title {
        height: 25px;
        display: flex;
        line-height: 25px;
        border-left: 4px solid #3875ff;
        justify-content: space-between;
        margin-bottom: 20px;
        font-size: 16px;
        font-weight: 600;
    }
    .xmjd-main {
        padding: 0 20px 20px 20px;
    }
    /deep/ .form-content-milepost .ant3-form-item-label {
        width: 130px;
    }
    .form-content-milepost {
        display: inline-block;
        width: calc(100% - 80px);
    }
    .add-btn-milepost {
        margin-top: 20px;
    }

    .score-title-first {
        background: rgba(250, 173, 20, 0.1);
        color: #262626;
        height: 36px;
        line-height: 36px;
        padding: 0 16px;
    }
    .score-title {
        font-size: 16px;
        color: #262626;
        font-weight: 600;
        margin: 18px 0;
    }
    .score-num {
        font-size: 18px;
        color: #3875ff;
        font-weight: 600;
    }
    .score-num-red {
        color: #f5222d;
        font-weight: 600;
    }
    .score-month {
        font-size: 16px;
        color: #262626;
        letter-spacing: 0;
        font-weight: 400;
        margin-bottom: 12px;
    }
    .month-score {
        font-size: 16px;
        color: #595959;
        letter-spacing: 0;
        font-weight: 400;
        display: inline-block;
        margin-left: 24px;
    }
    .default-score {
        font-size: 16px;
        color: #262626;
        letter-spacing: 0;
        font-weight: 500;
    }
    .score-table :deep(.@{ant-prefix}-table-thead) > tr > th {
        background: #3875ff;
        font-size: 14px;
        font-family: arial, helvetica, 'microsoft yahei';
        font-weight: 600;
        color: #fff;
        padding: 16px 16px;
        border: none;
    }
    /*样式*/
</style>
